package cn.tx.controller;

import cn.tx.pojo.domain.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RequestMapping("/user")
@RestController
public class UserController {
    @Value("${test.name}")
    private String testName;
    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable("id") Long id) {
        return new User(id,"姜雪宁","谢危"+testName);
    }

    @GetMapping("/getListUser")
    public List<User> getListUser(@RequestParam Map<String, Object> params) {
        List<User> listUser = new ArrayList<>();
        User user1 = new User(1L, "姜雪宁1", "谢危1" + testName);
        User user2 = new User(2L, "姜雪宁2", "谢危2" + testName);
        listUser.add(user1);
        listUser.add(user2);

        return listUser;
    }

}
